# -*- coding: utf-8 -*-
"""
@Time    : 2022/11/6 23:03
@Author  : JackXia
@Email   : 915624876@qq.com
@QQ      : 915624876
@File    : 双端队列-回文检测器.py
@Software: PyCharm
"""

from pythonds.basic import Deque


def palchecker(s: str):
    deque = Deque()
    for i in s:
        deque.addRear(i)

    while not deque.isEmpty() and deque.size() > 1:
        if deque.removeFront() != deque.removeRear():
            return False

    return True


class Solution(object):
    def isPalindrome(self, s):
        """
        :type s: str
        :rtype: bool
        """
        deque = []
        for i in s:
            if i.isalnum():
                deque.append(i.lower())

        while len(deque) > 1:
            if deque.pop(0) != deque.pop():
                return False

        return True


if __name__ == '__main__':
    # print(Solution().isPalindrome("A man, a plan, a canal: Panama"))
    # print(palchecker("A man, a plan, a canal: Panama"))
    # print(palchecker("to1ot"))
    t=1
    assert t != 1